package com.zrf.base.knowledge.mulip;

/**
 * 父类
 *
 * @author zhouruifeng
 *         create at 2017/3/19.
 */
public class Father {
    /**
     * 定义一个静态变量
     */
    private static int COUNT;
    /**
     * 定义一个私有的讲台变量查看什么时候赋值
     */
    private static final int ID = COUNT++;
    /**
     * 定义一个私有变量
     */
    private int reference;

    public Father() {
        System.out.println("father" + ID);
    }

    public void addReference() {
        reference++;
    }

    protected void dispose() {
        if (--reference == 0) {
            System.err.println("dispose count" + ID);
        }
    }
}
